import os
from core.rpc_client import RpcClient
from common.read_data import data

BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
data_file_path = os.path.join(BASE_PATH, "config", "setting.ini")
api_root_url = data.load_ini(data_file_path)["host"]["api_root_url"]


class Statistics(RpcClient):

    def __init__(self, api_root_url, **kwargs):
        super(Statistics, self).__init__(api_root_url, **kwargs)

    def login(self, params={}, **kwargs):
        return self.post("common.password_login", params, **kwargs)

    def real_login(self, params={}, **kwargs):
        return self.post("common.real_login", params, **kwargs)

    def region_vll(self, params={}, **kwargs):
        return self.post("statistics.region_vll", params, **kwargs)

    def multi_desc_vll(self, params={}, **kwargs):
        return self.post("statistics.multi_desc_vll", params, **kwargs)

    def vll_endpoints(self, params={}, **kwargs):
        return self.post("statistics.vll_endpoints", params, **kwargs)


statistics = Statistics(api_root_url)
